package class06;

/**
 * @description: https://leetcode.com/problems/maximum-depth-of-binary-tree/
 * @time: 2021/7/15 22:37
 * @author: lhy
 */
public class MaximumDepthOfBinaryTree {
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        }if (root.left == null && root.right == null){
            return 1;
        }
        return Math.max(maxDepth(root.left),maxDepth(root.right)) + 1;
    }
}
